home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / utility1 / gs261src.zip / INAME.H < prev    next >
C/C++ Source or Header  |  1993-05-13  |  3KB  |  69 lines

  1. /* Copyright (C) 1989, 1992, 1993 Aladdin Enterprises.  All rights reserved.
  2.  
  3. This file is part of Ghostscript.
  4.  
  5. Ghostscript is distributed in the hope that it will be useful, but
  6. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  7. to anyone for the consequences of using it or for whether it serves any
  8. particular purpose or works at all, unless he says so in writing.  Refer
  9. to the Ghostscript General Public License for full details.
  10.  
  11. Everyone is granted permission to copy, modify and redistribute
  12. Ghostscript, but only under the conditions described in the Ghostscript
  13. General Public License.  A copy of this license is supposed to have been
  14. given to you along with Ghostscript so you can know your rights and
  15. responsibilities.  It should be in a file named COPYING.  Among other
  16. things, the copyright notice and this notice must be preserved on all
  17. copies.  */
  18.  
  19. /* iname.h */
  20. /* Name table entry structure for Ghostscript */
  21.  
  22. /* Name structure.  The name table is a simple chained hash table. */
  23. /* There is an optimization to avoid lookup for operator and other */
  24. /* global names. */
  25. struct name_s {
  26.     ushort next_index;    /* next name in chain or 0 */
  27.     ushort string_size;
  28.     const byte *string_bytes;
  29. /* pvalue specifies the definition status of the name: */
  30. /*    pvalue == pv_no_defn: no definitions */
  31. #define pv_no_defn ((ref *)0)
  32. /*    pvalue == pv_other: other status */
  33. #define pv_other ((ref *)1)
  34. #define pv_valid(pvalue) ((unsigned long)(pvalue) > 1)
  35. /*    pvalue != pv_no_defn, pvalue != pv_other: pvalue is valid */
  36.     ref *pvalue;        /* if only defined in systemdict */
  37.                 /* or userdict, this points to */
  38.                 /* the value */
  39. };
  40. /*typedef struct name_s name;*/        /* in ghost.h */
  41.  
  42. /* Procedures for the name table. */
  43.  
  44. /* The size argument for name_ref should be a ushort, */
  45. /* but this gets the Apollo compiler confused. */
  46. /* enterflag=-1 means don't enter (return an error if missing); */
  47. /* enterflag=0 means enter if missing, don't copy the string; */
  48. /* enterflag=1 means enter if missing, copy the string. */
  49. extern    int    name_ref(P4(const byte *ptr, uint size, ref *pnref, int enterflag));
  50. extern    void    name_string_ref(P2(const ref *pnref, ref *psref));
  51. extern    void    name_enter(P2(const char *str, ref *pnref));
  52. /* name_from_string essentially implements cvn. */
  53. /* It always enters the name, and copies the executable attribute. */
  54. extern    int    name_from_string(P2(const ref *psref, ref *pnref));
  55.  
  56. /* Compare two names for equality. */
  57. #define name_eq(pnref1, pnref2)\
  58.   (name_index(pnref1) == name_index(pnref2))
  59.  
  60. /* Conversion between names and indices. */
  61. #define name_index(pnref) r_size(pnref)
  62. extern    void    name_index_ref(P2(uint index /* should be ushort */,
  63.                       ref *pnref));
  64. extern    uint    name_count(P0());
  65. extern    int    name_is_since_count(P2(const ref *, uint));
  66.  
  67. /* Clean up the name table before a restore. */
  68. extern    void    name_restore(P1(uint old_count));
  69.